package com.freecloud.javabasics.design.observer.subject;

import com.freecloud.javabasics.design.observer.EventLisenter;

/**
 * 被观察者
 * @Author: maomao
 * @Date: 2019-11-19 09:28
 */
public class Subject extends EventLisenter {

    /**
     * 通常使用动态代理来实现监控，避免代码侵入
     */
    public void add(){
        System.out.println("调用add方法");
        trigger(SubjectEventType.ON_ADD);
    }

    public void delete(){
        System.out.println("调用delete方法");
        trigger(SubjectEventType.ON_DELETE);
    }
}
